package heapTree.nodes;

public class StochasticNode<T extends Comparable<T>> implements Comparable<StochasticNode<T>> {	
	private long stochasticNodeId;
	private double probability;
	private double volatility;
	private Node node;
	
	public double getProbability() {
		return probability;
	}
	public void setProbability(double probability) {
		this.probability = probability;
	}
	public double getVolatility() {
		return volatility;
	}
	public void setVolatility(double volatility) {
		this.volatility = volatility;
	}
	public Node getNode() {
		return node;
	}
	public void setNode(Node node) {
		this.node = node;
	}
	
	public long getStochasticNodeId() {
		return stochasticNodeId;
	}

	public void setStochasticNodeId(int stochasticNodeId) {
		this.stochasticNodeId = stochasticNodeId;
	}

	@Override
	public int compareTo(StochasticNode<T> o) {
		if(this.stochasticNodeId==o.getStochasticNodeId())
			return 0;
		else if(this.stochasticNodeId<o.stochasticNodeId)
			return -1;
		else return 1;
	}
	
	public boolean equalValues(Object obj) {
		if(this == null)
			return false;
		if (this == obj)
			return true;
		if (getClass() != obj.getClass())
			return false;
		final StochasticNode other = (StochasticNode) obj;
		if (node == null) {
			if (other.node != null)
				return false;
		}
		if (Double.doubleToLongBits(probability) != Double
				.doubleToLongBits(other.probability))
			return false;
		if (Double.doubleToLongBits(volatility) != Double
				.doubleToLongBits(other.volatility))
			return false;
		if (node!=null && !node.equalValues(other.node))
			return false;
		return true;
	}
}
